<title>标题</title>
<!--当前位置开始-->
<div class="layui-card layadmin-header">
    <div class="layui-breadcrumb" lay-filter="breadcrumb">
        <script type="text/html" template lay-done="layui.data.updateMainBreadcrumb();">
        </script>
    </div>
</div>
<!--当前位置结束-->
<style>
    /* 重写样式 */
    .layui-form-item label { width: 140px; }
    .classifyimg { margin-bottom: 20px; width: 672px !important; }
    .classifyimg-item { display: inline-block; width: 140px; }
    .classifyimg img { width: 100px; display: block; }
    .classifyimg .layui-form-radio { vertical-align: top; display: block; margin-bottom: 10px; }
    .image_storage_type .item { display: none; }
    .layui-elem-quote { margin: 10px; }
    .layui-tab-content { padding: 15px 0; }
</style>
<script type="text/html" template lay-type="Post" lay-url="{{ layui.setter.apiUrl }}Api/CoreCmsSmsSetting/GetIndex" lay-done="layui.data.done(d);">
    <div class="layui-fluid">
        <div class="layui-row layui-col-space15">

            <div class="layui-col-md12">
                <div class="layui-card">

                    <div class="layui-card-body">
                        <div class="layui-tab  layui-tab-card" lay-filter="setting">
                            <ul class="layui-tab-title">
                                <li lay-id="sms" class="layui-this">短信设置</li>
                                <li lay-id="smsstr">凯信通短信内容模板</li>
                                <li lay-id="alipaysmsstr">阿里云短信编码模板</li>
                            </ul>
                            <div class="layui-tab-content">

                                <div class="layui-tab-item layui-show">
                                    <div class="layui-form coreshop-form">
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">{{d.data.configs['smsEnabled']['sKey']}}：</label>
                                            <div class="layui-input-inline layui-inline-7">
                                                <input type="radio" name="smsEnabled" value="1" title="开启" {{d.data.configs['smsEnabled']['sValue']==="1" ? 'checked':''}}>
                                                <input type="radio" name="smsEnabled" value="2" title="关闭" {{d.data.configs['smsEnabled']['sValue']==="2" ? 'checked':''}}>
                                            </div>
                                        </div>

                                        <div class="layui-form-item">
                                            <label class="layui-form-label">{{d.data.configs['smsType']['sKey']}}：</label>
                                            <div class="layui-input-inline layui-inline-7">
                                                <input type="radio" name="smsType" value="1" title="凯信通" {{d.data.configs['smsType']['sValue']==="1" ? 'checked':''}}>
                                                <input type="radio" name="smsType" value="2" title="阿里云" {{d.data.configs['smsType']['sValue']==="2" ? 'checked':''}}>
                                            </div>
                                        </div>

                                        <div class="layui-form-item">
                                            <label class="layui-form-label">{{d.data.configs['smsUserId']['sKey']}}：</label>
                                            <div class="layui-input-inline layui-inline-5">
                                                <input type="text" name="smsUserId" value="{{d.data.configs['smsUserId']['sValue']}}" lay-verify="number" autocomplete="off" placeholder="" class="layui-input">
                                            </div>
                                            <div class="layui-form-mid layui-word-aux">仅【凯信通】适用</div>
                                        </div>

                                        <div class="layui-form-item">
                                            <label class="layui-form-label">{{d.data.configs['smsAccount']['sKey']}}：</label>
                                            <div class="layui-input-inline layui-inline-5">
                                                <input type="text" name="smsAccount" value="{{d.data.configs['smsAccount']['sValue']}}" lay-verify="title" autocomplete="off" placeholder="" class="layui-input">
                                            </div>
                                            <div class="layui-form-mid layui-word-aux">【凯信通】为账号，【阿里云为AccessKey ID】</div>
                                        </div>

                                        <div class="layui-form-item">
                                            <label class="layui-form-label">{{d.data.configs['smsPassword']['sKey']}}：</label>
                                            <div class="layui-input-inline layui-inline-5">
                                                <input type="text" name="smsPassword" value="{{d.data.configs['smsPassword']['sValue']}}" lay-verify="title" autocomplete="off" placeholder="" class="layui-input">
                                            </div>
                                            <div class="layui-form-mid layui-word-aux">【凯信通】为密码，【阿里云为AccessKey Secret】</div>
                                        </div>

                                        <div class="layui-form-item">
                                            <label class="layui-form-label">{{d.data.configs['smsApiUrl']['sKey']}}：</label>
                                            <div class="layui-input-inline layui-inline-12">
                                                <input type="text" name="smsApiUrl" value="{{d.data.configs['smsApiUrl']['sValue']}}" lay-verify="title" autocomplete="off" placeholder="" class="layui-input">
                                            </div>
                                            <div class="layui-form-mid layui-word-aux">凯信通为：【http://sms.corecms.net:9999/sms.aspx】；阿里云为【dysmsapi.aliyuncs.com】，阿里云还请参考 https://api.aliyun.com/product/Dysmsapi</div>
                                        </div>


                                        <div class="layui-form-item">
                                            <label class="layui-form-label">{{d.data.configs['smsSignature']['sKey']}}：</label>
                                            <div class="layui-input-inline layui-inline-5">
                                                <input type="text" name="smsSignature" value="{{d.data.configs['smsSignature']['sValue']}}" lay-verify="title" autocomplete="off" placeholder="" class="layui-input">
                                            </div>
                                            <div class="layui-form-mid layui-word-aux">凯信通短信签名，2-8个汉字以内，阿里云为平台先通过申请</div>
                                        </div>

                                        <div class="layui-form-item">
                                            <label class="layui-form-label">{{d.data.configs['smsIpSendNumber']['sKey']}}：</label>
                                            <div class="layui-input-inline layui-inline-5">
                                                <input type="text" name="smsIpSendNumber" value="{{d.data.configs['smsIpSendNumber']['sValue']}}" lay-verify="title" autocomplete="off" placeholder="" class="layui-input">
                                            </div>
                                            <div class="layui-form-mid layui-word-aux">单个ip，每日请求的相关业务发送短信的数量。比如用户注册登录等。</div>
                                        </div>

                                        <div class="layui-form-item">
                                            <label class="layui-form-label">{{d.data.configs['smsIpSendWhiteList']['sKey']}}：</label>
                                            <div class="layui-input-inline layui-inline-5">
                                                <textarea name="smsIpSendWhiteList" cols="30" rows="10" class="layui-input" style="height: 100px; padding: 10px">{{d.data.configs['smsIpSendWhiteList']['sValue']}}</textarea>
                                            </div>
                                            <div class="layui-form-mid layui-word-aux">设置的ip将不受到每日发送的限制，一般是设置站点的ip地址，使用小写分割线“|”隔开</div>
                                        </div>

                                        <div class="layui-form-item">
                                            <label class="layui-form-label">{{d.data.configs['smsIpSendBlackList']['sKey']}}：</label>
                                            <div class="layui-input-inline layui-inline-5">
                                                <textarea name="smsIpSendBlackList" cols="30" rows="10" class="layui-input" style="height: 100px; padding: 10px">{{d.data.configs['smsIpSendBlackList']['sValue']}}</textarea>
                                            </div>
                                            <div class="layui-form-mid layui-word-aux">设置的ip地址将无法发送短信请求业务。，使用小写分割线“|”隔开</div>
                                        </div>


                                        <div class="layui-form-item">
                                            <label class="layui-form-label">&nbsp;</label>
                                            <div class="layui-input-block">
                                                <button class="layui-btn" lay-submit="" lay-filter="save">保存更改</button>
                                            </div>
                                        </div>
                                    </div>
                                </div>

                                <div class="layui-tab-item">
                                    <div class="layui-form coreshop-form">
                                        <blockquote class="layui-elem-quote">
                                            凯信通短信为直发内容，所以不需要模板，直接填写需要发送的内容即可。
                                        </blockquote>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">{{d.data.configs['smsTplForReg']['sKey']}}：</label>
                                            <div class="layui-input-inline layui-inline-12">
                                                <input type="text" name="smsTplForReg" value="{{d.data.configs['smsTplForReg']['sValue']}}" lay-verify="title" autocomplete="off" placeholder="" class="layui-input">
                                            </div>
                                            <div class="layui-form-mid layui-word-aux">{code}将替换代码中的数字验证码，请保持此规则</div>

                                        </div>

                                        <div class="layui-form-item">
                                            <label class="layui-form-label">{{d.data.configs['smsTplForLogin']['sKey']}}：</label>
                                            <div class="layui-input-inline layui-inline-12">
                                                <input type="text" name="smsTplForLogin" value="{{d.data.configs['smsTplForLogin']['sValue']}}" lay-verify="title" autocomplete="off" placeholder="" class="layui-input">
                                            </div>
                                            <div class="layui-form-mid layui-word-aux">{code}将替换代码中的数字验证码，请保持此规则</div>

                                        </div>

                                        <div class="layui-form-item">
                                            <label class="layui-form-label">{{d.data.configs['smsTplForVeri']['sKey']}}：</label>
                                            <div class="layui-input-inline layui-inline-12">
                                                <input type="text" name="smsTplForVeri" value="{{d.data.configs['smsTplForVeri']['sValue']}}" lay-verify="title" autocomplete="off" placeholder="" class="layui-input">
                                            </div>
                                            <div class="layui-form-mid layui-word-aux">{code}将替换代码中的数字验证码，请保持此规则</div>
                                        </div>

                                        <div class="layui-form-item">
                                            <label class="layui-form-label">{{d.data.configs['smsTplForCreateOrder']['sKey']}}：</label>
                                            <div class="layui-input-inline layui-inline-12">
                                                <input type="text" name="smsTplForCreateOrder" value="{{d.data.configs['smsTplForCreateOrder']['sValue']}}" lay-verify="title" autocomplete="off" placeholder="" class="layui-input">
                                            </div>
                                        </div>

                                        <div class="layui-form-item">
                                            <label class="layui-form-label">{{d.data.configs['smsTplForOrderPayed']['sKey']}}：</label>
                                            <div class="layui-input-inline layui-inline-12">
                                                <input type="text" name="smsTplForOrderPayed" value="{{d.data.configs['smsTplForOrderPayed']['sValue']}}" lay-verify="title" autocomplete="off" placeholder="" class="layui-input">
                                            </div>
                                        </div>

                                        <div class="layui-form-item">
                                            <label class="layui-form-label">{{d.data.configs['smsTplForRemindOrderPay']['sKey']}}：</label>
                                            <div class="layui-input-inline layui-inline-12">
                                                <input type="text" name="smsTplForRemindOrderPay" value="{{d.data.configs['smsTplForRemindOrderPay']['sValue']}}" lay-verify="title" autocomplete="off" placeholder="" class="layui-input">
                                            </div>
                                        </div>

                                        <div class="layui-form-item">
                                            <label class="layui-form-label">{{d.data.configs['smsTplForDeliveryNotice']['sKey']}}：</label>
                                            <div class="layui-input-inline layui-inline-12">
                                                <input type="text" name="smsTplForDeliveryNotice" value="{{d.data.configs['smsTplForDeliveryNotice']['sValue']}}" lay-verify="title" autocomplete="off" placeholder="" class="layui-input">
                                            </div>
                                        </div>

                                        <div class="layui-form-item">
                                            <label class="layui-form-label">{{d.data.configs['smsTplForAfterSalesPass']['sKey']}}：</label>
                                            <div class="layui-input-inline layui-inline-12">
                                                <input type="text" name="smsTplForAfterSalesPass" value="{{d.data.configs['smsTplForAfterSalesPass']['sValue']}}" lay-verify="title" autocomplete="off" placeholder="" class="layui-input">
                                            </div>
                                        </div>

                                        <div class="layui-form-item">
                                            <label class="layui-form-label">{{d.data.configs['smsTplForRefundSuccess']['sKey']}}：</label>
                                            <div class="layui-input-inline layui-inline-12">
                                                <input type="text" name="smsTplForRefundSuccess" value="{{d.data.configs['smsTplForRefundSuccess']['sValue']}}" lay-verify="title" autocomplete="off" placeholder="" class="layui-input">
                                            </div>
                                        </div>

                                        <div class="layui-form-item">
                                            <label class="layui-form-label">{{d.data.configs['smsTplForSellerOrderNotice']['sKey']}}：</label>
                                            <div class="layui-input-inline layui-inline-12">
                                                <input type="text" name="smsTplForSellerOrderNotice" value="{{d.data.configs['smsTplForSellerOrderNotice']['sValue']}}" lay-verify="title" autocomplete="off" placeholder="" class="layui-input">
                                            </div>
                                            <div class="layui-form-mid layui-word-aux">此短信是用来通知商家有新的订单使用。</div>

                                        </div>

                                        <div class="layui-form-item">
                                            <label class="layui-form-label">{{d.data.configs['smsTplForCommon']['sKey']}}：</label>
                                            <div class="layui-input-inline layui-inline-12">
                                                <input type="text" name="smsTplForCommon" value="{{d.data.configs['smsTplForCommon']['sValue']}}" lay-verify="title" autocomplete="off" placeholder="" class="layui-input">
                                            </div>
                                        </div>


                                        <div class="layui-form-item">
                                            <label class="layui-form-label">&nbsp;</label>
                                            <div class="layui-input-block">
                                                <button class="layui-btn" lay-submit="" lay-filter="save">保存更改</button>
                                            </div>
                                        </div>
                                    </div>
                                </div>

                                <div class="layui-tab-item">
                                    <div class="layui-form coreshop-form">
                                        <blockquote class="layui-elem-quote">
                                            1、阿里云短信填写的为模板编码，不是填写具体内容。另外注意前面三个验证码的短信，变量必须设置为 ${code}，否则无法发送。<br />
                                            2、阿里云短信模板编码，需要在阿里云短信服务中申请模板，然后填写模板编码。<br />
                                            3、阿里云的模板内容，可以参考凯信通我们内置的短信发送内容，仅供参考。
                                        </blockquote>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">{{d.data.configs['smsAliYunTplForReg']['sKey']}}：</label>
                                            <div class="layui-input-inline layui-inline-3">
                                                <input type="text" name="smsAliYunTplForReg" value="{{d.data.configs['smsAliYunTplForReg']['sValue']}}" lay-verify="title" autocomplete="off" placeholder="" class="layui-input">
                                            </div>
                                            <div class="layui-form-mid layui-word-aux">验证码短信，含变量属性，${code}将替换代码中的数字验证码，请在模板中选择验证码短信</div>

                                        </div>

                                        <div class="layui-form-item">
                                            <label class="layui-form-label">{{d.data.configs['smsAliYunTplForLogin']['sKey']}}：</label>
                                            <div class="layui-input-inline layui-inline-3">
                                                <input type="text" name="smsAliYunTplForLogin" value="{{d.data.configs['smsAliYunTplForLogin']['sValue']}}" lay-verify="title" autocomplete="off" placeholder="" class="layui-input">
                                            </div>
                                            <div class="layui-form-mid layui-word-aux">验证码短信，含变量属性，${code}将替换代码中的数字验证码，请在模板中选择验证码短信</div>

                                        </div>

                                        <div class="layui-form-item">
                                            <label class="layui-form-label">{{d.data.configs['smsAliYunTplForVeri']['sKey']}}：</label>
                                            <div class="layui-input-inline layui-inline-3">
                                                <input type="text" name="smsAliYunTplForVeri" value="{{d.data.configs['smsAliYunTplForVeri']['sValue']}}" lay-verify="title" autocomplete="off" placeholder="" class="layui-input">
                                            </div>
                                            <div class="layui-form-mid layui-word-aux">验证码短信，含变量属性，${code}将替换代码中的数字验证码，请在模板中选择验证码短信</div>
                                        </div>

                                        <div class="layui-form-item">
                                            <label class="layui-form-label">{{d.data.configs['smsAliYunTplForCreateOrder']['sKey']}}：</label>
                                            <div class="layui-input-inline layui-inline-3">
                                                <input type="text" name="smsAliYunTplForCreateOrder" value="{{d.data.configs['smsAliYunTplForCreateOrder']['sValue']}}" lay-verify="title" autocomplete="off" placeholder="" class="layui-input">
                                            </div>
                                            <div class="layui-form-mid layui-word-aux">通知短信，纯文本。无变量</div>
                                        </div>

                                        <div class="layui-form-item">
                                            <label class="layui-form-label">{{d.data.configs['smsAliYunTplForOrderPayed']['sKey']}}：</label>
                                            <div class="layui-input-inline layui-inline-3">
                                                <input type="text" name="smsAliYunTplForOrderPayed" value="{{d.data.configs['smsAliYunTplForOrderPayed']['sValue']}}" lay-verify="title" autocomplete="off" placeholder="" class="layui-input">
                                            </div>
                                            <div class="layui-form-mid layui-word-aux">通知短信，纯文本。无变量</div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">{{d.data.configs['smsAliYunTplForRemindOrderPay']['sKey']}}：</label>
                                            <div class="layui-input-inline layui-inline-3">
                                                <input type="text" name="smsAliYunTplForRemindOrderPay" value="{{d.data.configs['smsAliYunTplForRemindOrderPay']['sValue']}}" lay-verify="title" autocomplete="off" placeholder="" class="layui-input">
                                            </div>
                                            <div class="layui-form-mid layui-word-aux">通知短信，纯文本。无变量</div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">{{d.data.configs['smsAliYunTplForDeliveryNotice']['sKey']}}：</label>
                                            <div class="layui-input-inline layui-inline-3">
                                                <input type="text" name="smsAliYunTplForDeliveryNotice" value="{{d.data.configs['smsAliYunTplForDeliveryNotice']['sValue']}}" lay-verify="title" autocomplete="off" placeholder="" class="layui-input">
                                            </div>
                                            <div class="layui-form-mid layui-word-aux">通知短信，纯文本。无变量</div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">{{d.data.configs['smsAliYunTplForAfterSalesPass']['sKey']}}：</label>
                                            <div class="layui-input-inline layui-inline-3">
                                                <input type="text" name="smsAliYunTplForAfterSalesPass" value="{{d.data.configs['smsAliYunTplForAfterSalesPass']['sValue']}}" lay-verify="title" autocomplete="off" placeholder="" class="layui-input">
                                            </div>
                                            <div class="layui-form-mid layui-word-aux">通知短信，纯文本。无变量</div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">{{d.data.configs['smsAliYunTplForRefundSuccess']['sKey']}}：</label>
                                            <div class="layui-input-inline layui-inline-3">
                                                <input type="text" name="smsAliYunTplForRefundSuccess" value="{{d.data.configs['smsAliYunTplForRefundSuccess']['sValue']}}" lay-verify="title" autocomplete="off" placeholder="" class="layui-input">
                                            </div>
                                            <div class="layui-form-mid layui-word-aux">通知短信，纯文本。无变量</div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">{{d.data.configs['smsAliYunTplForSellerOrderNotice']['sKey']}}：</label>
                                            <div class="layui-input-inline layui-inline-3">
                                                <input type="text" name="smsAliYunTplForSellerOrderNotice" value="{{d.data.configs['smsAliYunTplForSellerOrderNotice']['sValue']}}" lay-verify="title" autocomplete="off" placeholder="" class="layui-input">
                                            </div>
                                            <div class="layui-form-mid layui-word-aux">通知短信，纯文本。无变量，此短信是用来通知商家有新的订单使用。</div>
                                        </div>

                                        <div class="layui-form-item">
                                            <label class="layui-form-label">{{d.data.configs['smsAliYunTplForCommon']['sKey']}}：</label>
                                            <div class="layui-input-inline layui-inline-3">
                                                <input type="text" name="smsAliYunTplForCommon" value="{{d.data.configs['smsAliYunTplForCommon']['sValue']}}" lay-verify="title" autocomplete="off" placeholder="" class="layui-input">
                                            </div>
                                            <div class="layui-form-mid layui-word-aux">通知短信，纯文本。无变量</div>
                                        </div>

                                        <div class="layui-form-item">
                                            <label class="layui-form-label">&nbsp;</label>
                                            <div class="layui-input-block">
                                                <button class="layui-btn" lay-submit="" lay-filter="save">保存更改</button>
                                            </div>
                                        </div>
                                    </div>
                                </div>

                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</script>
<script>
    var indexData;
    var debug = layui.setter.debug;
    layui.data.done = function (d) {
        //开启调试情况下获取接口赋值数据
        if (debug) { console.log(d); }
        indexData = d.data;
        layui.use(['admin', 'form', 'coreHelper', 'element', 'table', 'util', 'view', 'table', 'cropperImg'], function () {
            var $ = layui.$
                , setter = layui.setter
                , admin = layui.admin
                , coreHelper = layui.coreHelper
                , form = layui.form
                , element = layui.element
                , table = layui.table
                , util = layui.util
                , view = layui.view
                , cropperImg = layui.cropperImg
                , router = layui.router()
                , search = router.search;
            form.render();

            form.verify({
                money: [/((^[1-9]\d*)|^0)(\.\d{0,2}){0,1}$/, '请输入合法整数或小数'],
            });

            //保存数据
            form.on('submit(save)', function (data) {
                formData = data.field;
                if (!formData) {
                    layer.msg('请先完善数据', {
                        time: 1300
                    });
                    return false;
                }
                var field = data.field;
                var keys = Object.keys(field);
                var postData = [];
                for (var i = 0; i < keys.length; i++) {
                    var keyName = Object.keys(field)[i];

                    var entity = {};
                    entity.sKey = keyName;
                    entity.sValue = field[keyName];
                    postData.push(entity);
                }
                console.log(postData);
                coreHelper.Post("Api/CoreCmsSmsSetting/DoSave", { entity: postData }, function (e) {
                    if (debug) { console.log(e); } //开启调试返回数据
                    layer.msg(e.msg);
                });
            });
        });
    }
</script>